import {WidgetClass} from "../atom/widget";

export class PadRelatedRooms extends WidgetClass {
  constructor(options = {}) {
    super(options);
    const {ports, UI} = options;
    if (UI) {
      this.UI.data = UI.data;
    } else {
      this.UI.data = {
        itemSize: {
          width: 100,
          height: 46,
        },
        textSize: "16",
        itemTextColor: "text-color-secondary",
        itemBackColor: "bg-color-container",
        activeItemBackColor: "brand-color",
        activeItemTextColor: "text-color-anti"
      };
    }
    if (ports) {
      this.ports = ports;
    } else {
      this.ports = this.assembleDefaultPorts();
    }
  }

  assembleDefaultPorts() {
    const superState = super.assembleDefaultPorts();
    return {
      ...superState,
      values: [...superState.values, {
        name: "选择的房间",
        key: "roomId",
        type: "string",
        value: null
      }],
      events: [
        ...superState.events,
        {
          name: "房间切换",
          key: "changeRoom",
          eventType: "custom",
          type: "event",
          action: []
        },
      ],
    };
  }
}
